import {useRouter} from "vue-router";
import type {Router as RouterType} from "vue-router";

export class Nav {

  static router: RouterType | null = null

  //在App.vue里执行初始化
  static init() {
    this.router = useRouter()
  }

  static navigateTo(page: string) {
    this.router!.push(page).then()
  }

  static navigateBack() {
    this.router!.back()
  }

  static reLaunch(page: string) {
    this.router!.replace(page).then()
  }
}